package com.shujia.wyh.day12.ketang;

/*
        不同地方饮食文化不同的案例
 */
class Person {
    public void eat() {
        System.out.println("吃");
    }
}

class SouthPerson extends Person {
    @Override
    public void eat() {
        System.out.println("南方人吃米饭");
    }

    public void drinkTea() {
        System.out.println("南方人喜欢喝茶");
    }
}

class NorthPerson extends Person {
    @Override
    public void eat() {
        System.out.println("北方人吃面食");
    }

    public void bathe() {
        System.out.println("北方人洗澡");
    }

}

public class DuoTaiTest2 {
    public static void main(String[] args) {
        //多态
        Person p1 = new NorthPerson();
        p1.eat();
//        p1.bathe();
        NorthPerson np = (NorthPerson) p1;
        np.bathe();

        Person p2 = new SouthPerson();
        p2.eat();
//        p2.drinkTea;
        SouthPerson sp = (SouthPerson) p2;
        sp.drinkTea();
    }
}
